package com.asset.dispoal.defaultRoleDepartment.service.commom;

import com.asset.dispoal.defaultRoleDepartment.domain.db.entity.GbDefaultRoleDepartment;
import com.asset.dispoal.defaultRoleDepartment.domain.db.mapper.GbDefaultRoleDepartmentMapper;
import com.asset.dispoal.defaultRoleDepartment.dto.GbDefaultRoleDepartmentRequest;
import com.asset.dispoal.defaultRoleDepartment.service.converter.GbDefaultRoleDepartmentConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @author qr
 * @date 2022/3/21$
 */
@Component
public class GbDefaultRoleDepartmentInsert implements BaseCommand<GbDefaultRoleDepartmentRequest, Result> {

    @Autowired
    GbDefaultRoleDepartmentMapper gbDefaultRoleDepartmentMapper;


    @Override
    public Result execute(GbDefaultRoleDepartmentRequest request) {
        GbDefaultRoleDepartment gbDefaultRoleDepartment = GbDefaultRoleDepartmentConverter.INSTANCE.reqToDo(request);
        gbDefaultRoleDepartmentMapper.insert(gbDefaultRoleDepartment);
        return Result.ok();
    }
}
